<!DOCTYPE html>
<html>
<head basetarget="_parent">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- bootstrap -->
<link
	href="../static/bootstrap-3.3.7-dist/css/bootstrap.min.css"
	rel="stylesheet" />
<!-- 引入jqury,bootsrapt都依赖jqury，必须放在前面 -->
<script type="text/javascript" src="../static/js/jquery-3.3.1.min.js"></script>
<!-- 引入cookie -->
<script type="text/javascript"
	src="../static/js/jquery.cookie.js"></script>
<!-- 引入js -->
<script type="text/javascript"
	src="../static/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
</head>
<body>


	<nav class="navbar navbar-default navbar-static-top">
	<div class="container-fluid" >
		<div class="navbar-header">
			<a class="navbar-brand"
				style="margin-left: 150px; margin-top: -20px;" href="index.html" target="_parent">
				<h1>
					<span style="color: black;">Linux Microscope</span>
				</h1>
			</a>

		</div>
		<div class="" style="margin-top: 15px; float: right;">
			<span class="glyphicon glyphicon-user"></span> <a id="a_login" target="_parent">注册/登录</a>
		</div>


	</div>
	</nav>
<script type="text/javascript">
	// 登录flage
	var flag = false;
	//判断是否登录
	function checkLogin() {
		var docName=$.cookie("docName");
		var token=$.cookie("token");

		if(token!=""&&docName!=""&&docName!=undefined){
		//不需要id，直接根据docName去查个人信息	
			$("#a_login").text("欢迎 "+docName+"！").prop("alt","点击退出登录！");
			flag = true;
		}else {
			$("#a_login").prop("href","login.html");
		}
	}
	checkLogin();
	//如果已经登录，再次点击删除token 转到login
	if (flag) {
		$("#a_login").click(function () {
			$.cookie("token",'',-1);
			parent.location.reload();
		});
	}
</script>
</body>
</html>
